import mongoose, { Document, Schema } from 'mongoose'

export interface ICounter extends Document {
  _id: string
  seq: number
}

const CounterSchema: Schema = new Schema({
  _id: {
    type: String,
    required: true
  },
  seq: {
    type: Number,
    default: 0
  }
})

export const Counter = mongoose.model<ICounter>(
  'counter',
  CounterSchema,
  'counter'
)
